﻿using Shop.Collect;
using WeDonekRpc.Client.Attr;
using WeDonekRpc.Client.Interface;

namespace Shop.LocalEvent.Coupon
{
    [LocalEventName("Enable")]
    internal class CreateCouponCode : IEventHandler<CouponEvent>
    {
        private readonly ICouponCodeCollect _CouponCode;

        public CreateCouponCode (ICouponCodeCollect couponCode)
        {
            this._CouponCode = couponCode;
        }

        public void HandleEvent (CouponEvent data, string eventName)
        {
            this._CouponCode.Sync(data.Coupon.Id, data.Coupon.PutInNum);
        }
    }
}
